package com.windoent.yugioh.adapter;

import android.content.Context;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.viewpager.widget.PagerAdapter;

import java.util.List;

/**
 * author : HP
 * date   : 2020-09-07 17:42
 * desc   :shouye
 */
public class GameManagerFragmentViewPagerAdapter extends FragmentStatePagerAdapter {
    private Context mContext;
    private List<Fragment> fragments;
    private List<String> lists;

    public GameManagerFragmentViewPagerAdapter(FragmentManager fm, int behavior, Context context, List<String> lists, List<Fragment> fragments) {
        super(fm, behavior);
        this.mContext = context;
        this.fragments = fragments;
        this.lists = lists;
    }

    @Override
    public Fragment getItem(int i) {
        return fragments.get(i);
    }

    @Override
    public int getCount() {
        return lists.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return lists.get(position);
    }

    @Override
    public int getItemPosition(@NonNull Object object) {
        return PagerAdapter.POSITION_NONE;
    }
}
